import { FastifyRequest } from 'fastify';
import { CanActivate, ExecutionContext, Injectable } from '@nestjs/common';

@Injectable()
export class UserInfoGuard implements CanActivate {
    async canActivate(context: ExecutionContext): Promise<boolean> {
        const req = context.switchToHttp().getRequest() as FastifyRequest;
        req.body && Object.assign(req.body, req.cookies || {});
        return true;
    }
}
